home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1992 / number2 / cmos.c < prev    next >
C/C++ Source or Header  |  1992-04-16  |  773b  |  34 lines

  1. /* CMOS.C -- test CMOS RAM functions of RTCHDW.C
  2.  *
  3.  * Sample MAKE file:
  4.  *
  5.  * .c.obj:
  6.  *   bcc -c $<
  7.  *
  8.  * cmos.exe: cmos.obj rtchdw.obj
  9.  *   bcc cmos.obj rtchdw.obj
  10.  */
  11. #include <stdio.h>
  12. #include "rtc.h"
  13.  
  14. void main (void) {
  15.   int x,y,Loc,Data;
  16.  
  17.   printf ("\n%33s\n\n  ", "CMOS RAM Dump");
  18.   for (x = 0; x < 0x10; x++)
  19.     printf (" %2X", x);
  20.   puts ("\n--------------------------------------------------");
  21.   for (x = 0; x < 4; x++) {
  22.     printf ("%X ", x);
  23.     for (y = 0; y < 0x10; y++) {
  24.       Loc = (x << 4) + y;
  25.       Data = ReadCMOS (Loc);
  26.       printf (" %02X", Data);
  27.     }
  28.     printf ("\n");
  29.   }
  30.   WriteCMOS (0x1B, ReadCMOS (0x1B) + 1);
  31.   NewCMOSChecksum ();
  32.   printf ("\nNew value at location 1B = %02X\n", ReadCMOS (0x1B));
  33. }
  34.